refactor: replace exportName with name throughout codebase

- Update TpmjsToolDefinitionSchema to only use 'name' field
- Add 'sandbox' as valid category for sprites tools
- Update all package.json files to use 'name' instead of 'exportName'
- Update documentation and source files accordingly
- Add 11 new sprites tools for sandbox/code-execution
This commit is contained in:
Ajax Davis 2026-01-14 14:18:36 +10:00
parent b1dd3371cd
commit 2cd2b10cd0
91 changed files with 4019 additions and 195 deletions

View file

@ -0,0 +1,64 @@
#!/bin/bash
# Master validation script for top 3 priorities
# Exit 0 = all validations pass, Exit 1 = any validation fails
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "========================================"
echo " TPMJS Top 3 Priorities Validation"
echo "========================================"
echo ""
FAILED=0
# Priority 1: SDK Packages
echo ">>> Priority 1: SDK Packages"
echo ""
if "$SCRIPT_DIR/validate-sdk-packages.sh"; then
echo ""
echo ">>> Priority 1: PASSED"
else
echo ""
echo ">>> Priority 1: FAILED"
FAILED=$((FAILED + 1))
fi
echo ""
# Priority 2: Social Features
echo ">>> Priority 2: Social Proof & Discovery"
echo ""
if "$SCRIPT_DIR/validate-social-features.sh"; then
echo ""
echo ">>> Priority 2: PASSED"
else
echo ""
echo ">>> Priority 2: FAILED"
FAILED=$((FAILED + 1))
fi
echo ""
# Priority 3: Documentation
echo ">>> Priority 3: Documentation & Onboarding"
echo ""
if "$SCRIPT_DIR/validate-documentation.sh"; then
echo ""
echo ">>> Priority 3: PASSED"
else
echo ""
echo ">>> Priority 3: FAILED"
FAILED=$((FAILED + 1))
fi
echo ""
echo "========================================"
echo " Final Summary"
echo "========================================"
if [[ $FAILED -eq 0 ]]; then
echo "✓ All 3 priorities complete!"
exit 0
else
echo "$FAILED priority/priorities still need work"
exit 1
fi

View file

@ -0,0 +1,160 @@
#!/bin/bash
# Validation script for Priority 3: Documentation & Onboarding
# Exit 0 = validation passes, Exit 1 = validation fails
set -e
echo "=== Validating Documentation & Onboarding ==="
echo ""
ERRORS=0
# Check 1: API documentation pages
echo "1. Checking API documentation..."
API_DOCS_DIR="apps/web/src/app/docs/api"
if [[ -d "$API_DOCS_DIR" ]]; then
# Check for key API doc pages
REQUIRED_DOCS=("tools" "agents" "collections" "authentication")
for doc in "${REQUIRED_DOCS[@]}"; do
if [[ -f "$API_DOCS_DIR/$doc/page.tsx" ]] || [[ -f "$API_DOCS_DIR/$doc/page.mdx" ]]; then
echo " ✓ API docs: $doc exists"
else
echo " ✗ API docs: $doc missing"
ERRORS=$((ERRORS + 1))
fi
done
else
echo " ✗ API documentation directory missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 2: Interactive tutorial/quickstart
echo "2. Checking interactive tutorial..."
if [[ -f "apps/web/src/app/docs/quickstart/page.tsx" ]] || \
[[ -f "apps/web/src/app/tutorial/page.tsx" ]] || \
[[ -f "apps/web/src/app/getting-started/page.tsx" ]]; then
echo " ✓ Tutorial/quickstart page exists"
else
echo " ✗ Interactive tutorial missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 3: Example code snippets
echo "3. Checking example code..."
EXAMPLES_COUNT=$(grep -r '\`\`\`typescript\|\`\`\`javascript\|\`\`\`bash' apps/web/src/app/docs/ 2>/dev/null | wc -l || echo "0")
if [[ "$EXAMPLES_COUNT" -gt 20 ]]; then
echo " ✓ Found $EXAMPLES_COUNT code examples in docs"
else
echo " ✗ Insufficient code examples (found: $EXAMPLES_COUNT, need: 20+)"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 4: SDK documentation
echo "4. Checking SDK documentation..."
if [[ -f "apps/web/src/app/docs/sdk/page.tsx" ]] || \
[[ -d "apps/web/src/app/docs/sdk" ]]; then
echo " ✓ SDK documentation exists"
else
echo " ✗ SDK documentation missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 5: Tool development guide
echo "5. Checking tool development guide..."
if [[ -f "apps/web/src/app/docs/publishing/page.tsx" ]] || \
[[ -f "apps/web/src/app/publish/page.tsx" ]]; then
# Check for comprehensive content
FILE=$(find apps/web/src/app -name "page.tsx" -path "*publish*" -o -name "page.tsx" -path "*docs/publishing*" 2>/dev/null | head -1)
if [[ -n "$FILE" ]] && [[ $(wc -l < "$FILE") -gt 100 ]]; then
echo " ✓ Tool development guide exists and is comprehensive"
else
echo " ⚠ Tool development guide exists but may be short"
fi
else
echo " ✗ Tool development guide missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 6: API endpoint documentation completeness
echo "6. Checking API endpoint coverage..."
API_ROUTES=$(find apps/web/src/app/api -name "route.ts" 2>/dev/null | wc -l)
DOCUMENTED_ROUTES=$(grep -r "@api\|@route\|endpoint" apps/web/src/app/docs/api/ 2>/dev/null | wc -l || echo "0")
echo " API routes: $API_ROUTES"
echo " Documented references: $DOCUMENTED_ROUTES"
if [[ "$DOCUMENTED_ROUTES" -gt "$((API_ROUTES / 2))" ]]; then
echo " ✓ Good documentation coverage"
else
echo " ✗ Insufficient API documentation coverage"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 7: Onboarding flow components
echo "7. Checking onboarding components..."
if grep -rq "onboarding\|firstTime\|welcome\|tutorial" apps/web/src/components/ 2>/dev/null || \
[[ -d "apps/web/src/components/onboarding" ]]; then
echo " ✓ Onboarding components exist"
else
echo " ✗ Onboarding components missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 8: Example agents/collections
echo "8. Checking example templates..."
if grep -rq "example\|template\|starter" apps/web/src/app/docs/ 2>/dev/null || \
[[ -d "apps/web/src/app/templates" ]]; then
echo " ✓ Example templates exist"
else
echo " ✗ Example templates missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 9: Search/navigation in docs
echo "9. Checking docs navigation..."
if [[ -f "apps/web/src/components/docs/DocsSidebar.tsx" ]] || \
[[ -f "apps/web/src/app/docs/layout.tsx" ]]; then
echo " ✓ Docs navigation exists"
else
echo " ✗ Docs navigation missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 10: Troubleshooting guide
echo "10. Checking troubleshooting guide..."
if [[ -f "apps/web/src/app/docs/troubleshooting/page.tsx" ]] || \
grep -rq "troubleshoot\|common errors\|FAQ" apps/web/src/app/docs/ 2>/dev/null; then
echo " ✓ Troubleshooting content exists"
else
echo " ✗ Troubleshooting guide missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
echo "=== Validation Summary ==="
if [[ $ERRORS -eq 0 ]]; then
echo "✓ All checks passed!"
exit 0
else
echo "$ERRORS check(s) failed"
exit 1
fi

View file

@ -0,0 +1,169 @@
#!/bin/bash
# Validation script for Priority 1: Complete SDK Packages
# Exit 0 = validation passes, Exit 1 = validation fails
set -e
echo "=== Validating SDK Packages ==="
echo ""
ERRORS=0
# Check 1: @tpmjs/registry-search package exists
echo "1. Checking @tpmjs/registry-search package..."
if [[ -d "packages/registry-search" ]] && [[ -f "packages/registry-search/package.json" ]]; then
echo " ✓ Package directory exists"
# Check for src/index.ts
if [[ -f "packages/registry-search/src/index.ts" ]]; then
echo " ✓ Source file exists"
else
echo " ✗ Missing src/index.ts"
ERRORS=$((ERRORS + 1))
fi
# Check package.json has correct name
if grep -q '"name": "@tpmjs/registry-search"' packages/registry-search/package.json; then
echo " ✓ Package name correct"
else
echo " ✗ Package name incorrect"
ERRORS=$((ERRORS + 1))
fi
else
echo " ✗ Package directory missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 2: @tpmjs/registry-execute package exists
echo "2. Checking @tpmjs/registry-execute package..."
if [[ -d "packages/registry-execute" ]] && [[ -f "packages/registry-execute/package.json" ]]; then
echo " ✓ Package directory exists"
if [[ -f "packages/registry-execute/src/index.ts" ]]; then
echo " ✓ Source file exists"
else
echo " ✗ Missing src/index.ts"
ERRORS=$((ERRORS + 1))
fi
if grep -q '"name": "@tpmjs/registry-execute"' packages/registry-execute/package.json; then
echo " ✓ Package name correct"
else
echo " ✗ Package name incorrect"
ERRORS=$((ERRORS + 1))
fi
else
echo " ✗ Package directory missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 3: TypeScript compiles
echo "3. Checking TypeScript compilation..."
if command -v pnpm &> /dev/null; then
if pnpm --filter=@tpmjs/registry-search type-check 2>/dev/null; then
echo " ✓ registry-search compiles"
else
echo " ✗ registry-search has type errors"
ERRORS=$((ERRORS + 1))
fi
if pnpm --filter=@tpmjs/registry-execute type-check 2>/dev/null; then
echo " ✓ registry-execute compiles"
else
echo " ✗ registry-execute has type errors"
ERRORS=$((ERRORS + 1))
fi
else
echo " ⚠ pnpm not available, skipping type check"
fi
echo ""
# Check 4: Packages have required exports
echo "4. Checking required exports..."
REQUIRED_SEARCH_EXPORTS=("searchTools" "getToolById" "getTrendingTools")
REQUIRED_EXECUTE_EXPORTS=("executeToolCall" "createToolClient")
if [[ -f "packages/registry-search/src/index.ts" ]]; then
for export in "${REQUIRED_SEARCH_EXPORTS[@]}"; do
if grep -q "export.*$export" packages/registry-search/src/index.ts 2>/dev/null || \
grep -q "export.*$export" packages/registry-search/src/*.ts 2>/dev/null; then
echo " ✓ registry-search exports $export"
else
echo " ✗ registry-search missing export: $export"
ERRORS=$((ERRORS + 1))
fi
done
fi
if [[ -f "packages/registry-execute/src/index.ts" ]]; then
for export in "${REQUIRED_EXECUTE_EXPORTS[@]}"; do
if grep -q "export.*$export" packages/registry-execute/src/index.ts 2>/dev/null || \
grep -q "export.*$export" packages/registry-execute/src/*.ts 2>/dev/null; then
echo " ✓ registry-execute exports $export"
else
echo " ✗ registry-execute missing export: $export"
ERRORS=$((ERRORS + 1))
fi
done
fi
echo ""
# Check 5: Tests exist and pass
echo "5. Checking tests..."
if [[ -d "packages/registry-search/src/__tests__" ]] || [[ -d "packages/registry-search/test" ]]; then
echo " ✓ registry-search has tests"
else
echo " ✗ registry-search missing tests"
ERRORS=$((ERRORS + 1))
fi
if [[ -d "packages/registry-execute/src/__tests__" ]] || [[ -d "packages/registry-execute/test" ]]; then
echo " ✓ registry-execute has tests"
else
echo " ✗ registry-execute missing tests"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 6: README documentation
echo "6. Checking documentation..."
if [[ -f "packages/registry-search/README.md" ]]; then
if [[ $(wc -l < packages/registry-search/README.md) -gt 20 ]]; then
echo " ✓ registry-search has README"
else
echo " ✗ registry-search README too short"
ERRORS=$((ERRORS + 1))
fi
else
echo " ✗ registry-search missing README"
ERRORS=$((ERRORS + 1))
fi
if [[ -f "packages/registry-execute/README.md" ]]; then
if [[ $(wc -l < packages/registry-execute/README.md) -gt 20 ]]; then
echo " ✓ registry-execute has README"
else
echo " ✗ registry-execute README too short"
ERRORS=$((ERRORS + 1))
fi
else
echo " ✗ registry-execute missing README"
ERRORS=$((ERRORS + 1))
fi
echo ""
echo "=== Validation Summary ==="
if [[ $ERRORS -eq 0 ]]; then
echo "✓ All checks passed!"
exit 0
else
echo "$ERRORS check(s) failed"
exit 1
fi

View file

@ -0,0 +1,143 @@
#!/bin/bash
# Validation script for Priority 2: Social Proof & Discovery Features
# Exit 0 = validation passes, Exit 1 = validation fails
set -e
echo "=== Validating Social Proof & Discovery Features ==="
echo ""
ERRORS=0
# Check 1: Rating system API routes
echo "1. Checking rating API routes..."
if [[ -f "apps/web/src/app/api/tools/[id]/rate/route.ts" ]]; then
echo " ✓ Tool rating route exists"
# Check for POST handler
if grep -q "export async function POST" "apps/web/src/app/api/tools/[id]/rate/route.ts"; then
echo " ✓ POST handler for rating exists"
else
echo " ✗ Missing POST handler for rating"
ERRORS=$((ERRORS + 1))
fi
else
echo " ✗ Tool rating route missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 2: Review system API routes
echo "2. Checking review API routes..."
if [[ -f "apps/web/src/app/api/tools/[id]/reviews/route.ts" ]]; then
echo " ✓ Tool reviews route exists"
if grep -q "export async function GET" "apps/web/src/app/api/tools/[id]/reviews/route.ts"; then
echo " ✓ GET handler for reviews exists"
else
echo " ✗ Missing GET handler for reviews"
ERRORS=$((ERRORS + 1))
fi
if grep -q "export async function POST" "apps/web/src/app/api/tools/[id]/reviews/route.ts"; then
echo " ✓ POST handler for reviews exists"
else
echo " ✗ Missing POST handler for reviews"
ERRORS=$((ERRORS + 1))
fi
else
echo " ✗ Tool reviews route missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 3: Database schema for ratings/reviews
echo "3. Checking database schema..."
if grep -q "model ToolRating" "packages/db/prisma/schema.prisma"; then
echo " ✓ ToolRating model exists"
else
echo " ✗ ToolRating model missing"
ERRORS=$((ERRORS + 1))
fi
if grep -q "model ToolReview" "packages/db/prisma/schema.prisma"; then
echo " ✓ ToolReview model exists"
else
echo " ✗ ToolReview model missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 4: Trending tools API
echo "4. Checking trending tools..."
if [[ -f "apps/web/src/app/api/tools/trending/route.ts" ]]; then
echo " ✓ Trending tools route exists"
else
echo " ✗ Trending tools route missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 5: UI Components for ratings/reviews
echo "5. Checking UI components..."
if [[ -f "packages/ui/src/Rating/Rating.tsx" ]] || [[ -f "apps/web/src/components/Rating.tsx" ]]; then
echo " ✓ Rating component exists"
else
echo " ✗ Rating component missing"
ERRORS=$((ERRORS + 1))
fi
if [[ -f "packages/ui/src/ReviewCard/ReviewCard.tsx" ]] || [[ -f "apps/web/src/components/ReviewCard.tsx" ]]; then
echo " ✓ ReviewCard component exists"
else
echo " ✗ ReviewCard component missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
# Check 6: Tool page shows ratings
echo "6. Checking tool page integration..."
if [[ -f "apps/web/src/app/tool/[slug]/page.tsx" ]]; then
if grep -q "Rating\|rating\|averageRating" "apps/web/src/app/tool/[slug]/page.tsx"; then
echo " ✓ Tool page shows ratings"
else
echo " ✗ Tool page missing rating display"
ERRORS=$((ERRORS + 1))
fi
if grep -q "Review\|review" "apps/web/src/app/tool/[slug]/page.tsx"; then
echo " ✓ Tool page shows reviews"
else
echo " ✗ Tool page missing reviews display"
ERRORS=$((ERRORS + 1))
fi
else
echo " ⚠ Tool page not found at expected location"
fi
echo ""
# Check 7: Average rating calculation
echo "7. Checking rating aggregation..."
if grep -q "averageRating" "packages/db/prisma/schema.prisma" || \
grep -rq "AVG.*rating\|averageRating" "apps/web/src/app/api/"; then
echo " ✓ Rating aggregation exists"
else
echo " ✗ Rating aggregation missing"
ERRORS=$((ERRORS + 1))
fi
echo ""
echo "=== Validation Summary ==="
if [[ $ERRORS -eq 0 ]]; then
echo "✓ All checks passed!"
exit 0
else
echo "$ERRORS check(s) failed"
exit 1
fi